﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Ultility;
using ToolwebAQ.database;

namespace ToolwebAQ.adminaq
{
    public partial class Adminpage : System.Web.UI.MasterPage
    {
        aquariusDBDataContext db = new aquariusDBDataContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            //Response.Cookies["StoredURLFromLastSession"].Value = Request.Url.PathAndQuery.ToString(); 
            if (Session[Source.obj_Account] != null)
            {
                UserControl u = new UserControl();
                loadmenu.Controls.Add(u.LoadControl("~/adminaq/usercontrol/submenu.ascx"));
            }
            else
            {
                Response.Redirect("../adminaq/AQLogin.aspx");
            }
            if (!IsPostBack)
            {
                var listitem = db.sp_Tbl_cate_type_select_detail_cate(int.Parse(Session[Source.obj_Cateid].ToString())).ToList();
                foreach (var item in listitem)
                {
                    Drop_loai.DataSource = Cache["danhmuckn"];
                    Drop_loai.DataTextField = "cate_type";
                    Drop_loai.DataValueField = "id_cate";
                    Drop_loai.DataBind();
                    Drop_loai.SelectedIndex = Int32.Parse(item.id_cate.ToString()) - 1;
                    account.InnerText = Session[Source.obj_Account].ToString();
                }
            }
        }
    }
}
